package com.bos.service.imp;

import com.bos.dao.IDecideZoneDao;
import com.bos.dao.ISubareaDao;
import com.bos.domain.Decidedzone;
import com.bos.domain.Subarea;
import com.bos.service.IDecidedZoneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author Administrator
 */
@Service
@Transactional
public class IDecidedZoneServiceImp implements IDecidedZoneService {

    @Autowired
    private ISubareaDao subareaDao;

    @Autowired
    private IDecideZoneDao decideZoneDao;

    @Override
    public void save(Decidedzone decidedzone, String[] subareaId) {
        decideZoneDao.save(decidedzone);
        for (String subId : subareaId) {
            Subarea subarea = subareaDao.findById(subId);
            subarea.setDecidedzone(decidedzone);
        }
    }

    @Override
    public Decidedzone findById(String id) {
        return decideZoneDao.findById(id);
    }


}
